package com.cyzy.controller;

import com.cyzy.pojo.Email;
import com.cyzy.service.EmailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/email")
public class EmailController {

    @Autowired
    private EmailService emailService;

    @GetMapping("/systemEmail")
    public String sendEmail(Email email) {
        int templateId = email.getTemplateId();
        if(templateId == 1){
            emailService.emailLogin(email.getTo(),  templateId, email.getUserName(), email.getCode());
        }else if(templateId == 2){

        }
//        emailService.sendSimpleEmail(to, subject, text);
        return "Email sent successfully!";
    }
}
